import React from 'react';
import {connect} from 'react-redux';
import {Button, View} from 'react-native';
import {RootStackNavigation} from '@/navigator/index';
import {RootState} from '@/models/index';
import Carousel from './carousel';

interface IProps {
  navigation: RootStackNavigation;

  [key: string]: any;
}

class Index extends React.Component<IProps> {
  onPress = () => {
    const {navigation} = this.props;
    navigation.navigate('Detail', {
      id: 2,
    });
  };

  render() {
    return (
      <View>
        <Button title="跳转到详情页" onPress={this.onPress} />
        <Carousel />
      </View>
    );
  }
}

const mapStateToProps = (state: RootState) => state;

export default connect(mapStateToProps)(Index);
